package com.lagou.edu.factory;

import java.util.Arrays;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 * 依赖注入
 */
public class DependencyInjection {

    public DependencyInjection(){
    }

    // 构造器注入
    public DependencyInjection(ScopeOfSingletonBean scopeOfSingletonBean, String name, Integer age, float money) {
        this.scopeOfSingletonBean = scopeOfSingletonBean;
        this.name = name;
        this.age = age;
        this.money = money;
    }

    // set方法注入
    // 其他Bean类型
    private ScopeOfSingletonBean scopeOfSingletonBean;
    // 基本类型和String
    private String name;
    private Integer age;
    private float money;
    // 复杂类型（集合类型）
    private String[] myArray;
    private Map<String, String> myMap;
    private Set<String> mySet;
    private Properties properties;

    public void setScopeOfSingletonBean(ScopeOfSingletonBean scopeOfSingletonBean) {
        this.scopeOfSingletonBean = scopeOfSingletonBean;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setMoney(float money) {
        this.money = money;
    }

    public void setMyArray(String[] myArray) {
        this.myArray = myArray;
    }

    public void setMyMap(Map<String, String> myMap) {
        this.myMap = myMap;
    }

    public void setMySet(Set<String> mySet) {
        this.mySet = mySet;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    @Override
    public String toString() {
        return "DependencyInjection{" +
                "scopeOfSingletonBean=" + scopeOfSingletonBean +
                ", \n name='" + name + '\'' +
                ", \n age=" + age +
                ", \n money=" + money +
                ", \n myArray=" + Arrays.toString(myArray) +
                ", \n myMap=" + myMap +
                ", \n mySet=" + mySet +
                ", \n properties=" + properties +
                '}';
    }
}
